package com.secure;

import java.io.IOException;
import java.math.BigInteger;

public class testRSA {

	
	public testRSA(){
		String ciphertext = null;
		
		RSA rsa=new RSA();
		
		rsa.rsaKeyGen();
		BigInteger n=rsa.getN();
		BigInteger e=rsa.getE();
		BigInteger d=rsa.getD();

		System.out.println("n = " + n.toString());
		System.out.println("e = " + e.toString());
		System.out.println("d = " + d.toString());

		try {
			ciphertext = rsa.encodeMessage("Test", n, e);
		} catch (IOException e1) {
			e1.printStackTrace();
		}
		System.out.println("Coded: "+ciphertext);

		System.out.println("Decoded: " + rsa.decodeMessage(ciphertext, n, d));
	}
	
	public static void main(String[] args) {
		new testRSA();

	}

}
